import BaseView from "./base/BaseView";
import SeptkapaModule from "./module/SeptkapaModule";
import LogModule from "./module/LogModule";
import TushareModule from "./module/TushareModule";
import FileModule from "./module/FileModule";

const {ccclass, property} = cc._decorator;

@ccclass
export default class FindScene extends BaseView {

    onLoad () {
        LogModule.module.init();
        this.show();
        let sptekapa = SeptkapaModule.getInstance();
        sptekapa.initModule();
        
        cc.debug.setDisplayStats(false);
    }

    protected onDestroy(): void {
        LogModule.module.save();
    }

    onBtnSWPlate () {
        this.createDialog(BaseView.Views.SWPlateView);
    }

    onBtnSearch () {
        this.createDialog(BaseView.Views.SearchStockView);
    }

    onBtnAmount () {
        this.createDialog(BaseView.Views.PlateAmountView);
    }

    onBtnPlateCompare () {
        this.createDialog(BaseView.Views.PlateCompareView);
    }

    async onBtnLimitUp () {
        this.createDialog(BaseView.Views.UpLimitLookView);
        await TushareModule.getInstance().initDailyTopData();
    }

    onBtnEmote () {
        this.createDialog(BaseView.Views.EmoteTrendView);
    }

    onBtnRank () {
        this.createDialog(BaseView.Views.StockDaysRankView);
    }

    onBtnThsRank () {
        this.createDialog(BaseView.Views.ThsDaysRankView);
    }

    onBtnTest () {
        TushareModule.getInstance().analyseMainBz();
    }

    onBtnDelete() {
        FileModule.deleteToday();
    }

    onBtnDelMonth() {
        FileModule.deleteMonth();
    }
}
